const dayjs = require('dayjs')
const utc = require('dayjs/plugin/utc');
const timezone = require('dayjs/plugin/timezone');
const cloud = require('wx-server-sdk')

// 给dayjs添加时区选项
dayjs.extend(utc);
dayjs.extend(timezone);
cloud.init({
    env: 'everyday-4gkd6una188bf952'
})
const db = cloud.database()

module.exports = async function (data = {}) {
    const result = await db.collection('remind').add({
        data: {
            ...data,
            createTime: dayjs().tz('Asia/Shanghai').format('YYYY-MM-DD HH:mm:ss')
        }
    })
    return result
}